<?php

declare(strict_types=1);

namespace app\model\system;

use owns\interface\OwnsModelInteface;

class DictTypeModel extends OwnsModelInteface
{
    protected $name = 'system_dict_type';

    protected $field = [];

    /**
     * 查询条件
     * @param object $query
     * @param array $param
     */
    public function scopeCustom(object $query, array $param)
    {
        // 字典名称
        if($name = $param['name'] ?? '') {
            $query->whereLike('name', 'like', trim($name) . '%');
        }
        // 字典标示
        if($code = $param['code'] ?? '') {
            $query->whereLike('code', 'like', trim($code) . '%');
        }
    }
}
